
#ifndef _NO_OPENMP
#define _NO_OPENMP
inline int omp_get_num_threads() { return 1;}
inline int omp_get_max_threads() { return 1;}
inline int omp_get_thread_num() { return 0;}

typedef unsigned char omp_lock_t;
inline void omp_set_lock( omp_lock_t *dum) {;}
inline void omp_unset_lock( omp_lock_t *dum) {};
inline void omp_init_lock( omp_lock_t *dum) {};
inline void omp_destroy_lock( omp_lock_t *dum) {};

#ifdef WIN32
#include <time.h>
#include <sys/types.h>
#include <sys/timeb.h>
#else
#include <unistd.h>
#include <sys/times.h>
#include <sys/timeb.h>
#include <time.h> // CLK_TCK
#  ifndef CLK_TCK
#   define CLK_TCK      CLOCKS_PER_SEC
#  endif
#endif

inline int no_omp_currentWallTime( struct timeb *tp) {
#ifndef _WIN32
  return ftime( tp);
#else
  // MS Wind de los co...... que no respeta los estandares.
  ftime( tp);
  return 0;
#endif
}

inline double omp_get_wtime() {
  static struct timeb _time_inicio;
  static int init = 0;
  struct timeb tmp;
  if ( !init) {
    no_omp_currentWallTime( &_time_inicio);
    init = 1;
  }
  no_omp_currentWallTime( &tmp);
  time_t dif_sec = tmp.time - _time_inicio.time;
  int dif_msec = tmp.millitm - _time_inicio.millitm;
  double res = ( ( double)( dif_sec * 1000 + dif_msec) / 1000.0);
  return res;
}
#endif // _NO_OPENMP

